<html>
<head><meta charset="utf-8"><title>using macros 2.0 in the compiler · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/using.20macros.202.2E0.20in.20the.20compiler.html">using macros 2.0 in the compiler</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="247082371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/using%20macros%202.0%20in%20the%20compiler/near/247082371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bstrie <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/using.20macros.202.2E0.20in.20the.20compiler.html#247082371">(Jul 24 2021 at 16:15)</a>:</h4>
<p>Since macros 2.0 are starting to get used more in the stdlib, I've been thinking about dogfooding them in the compiler itself. AIUI one of the biggest open questions regarding macros 2.0 is how control over hygiene ought to be exposed to users, and I think using them in the compiler will give us a lot of data about how typical macros in the wild react to the stricter-by-default hygiene of macros 2.0. Would anyone with reviewer privileges be interested in aiding in this effort? My plan is to convert only a few crates at a time to make things easier to review and less likely to rot. I have a PR open at <a href="https://github.com/rust-lang/rust/pull/85690">https://github.com/rust-lang/rust/pull/85690</a> that converts the macros in rustc_arena; we can see that two of its macros are fine with stricter hygiene, and one needs looser hygiene.</p>



<a name="247083586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/using%20macros%202.0%20in%20the%20compiler/near/247083586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/using.20macros.202.2E0.20in.20the.20compiler.html#247083586">(Jul 24 2021 at 16:49)</a>:</h4>
<p>Won't that make the docs worse, because private macros won't be documented?</p>



<a name="247083678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/using%20macros%202.0%20in%20the%20compiler/near/247083678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bstrie <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/using.20macros.202.2E0.20in.20the.20compiler.html#247083678">(Jul 24 2021 at 16:52)</a>:</h4>
<p>isn't it expected that private items wouldn't be rendered in the docs? (note that all of the macros in the linked PR are public, and none have docs anyway)</p>



<a name="247083707"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/using%20macros%202.0%20in%20the%20compiler/near/247083707" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/using.20macros.202.2E0.20in.20the.20compiler.html#247083707">(Jul 24 2021 at 16:52)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/73754">https://github.com/rust-lang/rust/issues/73754</a></p>



<a name="247083725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/using%20macros%202.0%20in%20the%20compiler/near/247083725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/using.20macros.202.2E0.20in.20the.20compiler.html#247083725">(Jul 24 2021 at 16:52)</a>:</h4>
<p>Rustc uses --document-private-items, so this would be a regression compared to macro rules</p>



<a name="247083745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/using%20macros%202.0%20in%20the%20compiler/near/247083745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/using.20macros.202.2E0.20in.20the.20compiler.html#247083745">(Jul 24 2021 at 16:53)</a>:</h4>
<p>Ah ok, if it doesn't actually affect anything it's probably fine. But I don't think we should convert any private macros until the bugs in rustdoc are fixed.</p>



<a name="247083797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/using%20macros%202.0%20in%20the%20compiler/near/247083797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bstrie <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/using.20macros.202.2E0.20in.20the.20compiler.html#247083797">(Jul 24 2021 at 16:54)</a>:</h4>
<p>sure, I'm open to only migrating public macros for now. this is exactly the sort of thing that this effort is intended to bring to light :)</p>



<a name="247083840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/using%20macros%202.0%20in%20the%20compiler/near/247083840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/using.20macros.202.2E0.20in.20the.20compiler.html#247083840">(Jul 24 2021 at 16:55)</a>:</h4>
<p>(FWIW I don't think this is bringing anything to light we haven't discussed already - this has the same root cause as the <code>pub use</code> problem you found)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>